home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / c / AMesaRTL.lha / Mesa-2.6 / amiga / src-glut / glutstuff.h < prev    next >
C/C++ Source or Header  |  1998-09-19  |  4KB  |  180 lines

  1. /*
  2.  * Amiga GLUT graphics library toolkit
  3.  * Version:  2.0
  4.  * Copyright (C) 1998 Jarno van der Linden
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Library General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Library General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Library General Public
  17.  * License along with this library; if not, write to the Free
  18.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21.  
  22. /*
  23.  * glutstuff.h
  24.  *
  25.  * Version 1.0  27 Jun 1998
  26.  * by Jarno van der Linden
  27.  * jarno@kcbbs.gen.nz
  28.  *
  29.  * Version 1.1  02 Aug 1998
  30.  * by Jarno van der Linden
  31.  * jarno@kcbbs.gen.nz
  32.  *
  33.  * - Quantizer plugin support added
  34.  *
  35.  * Version 2.0  19 Sep 1998
  36.  * by Jarno van der Linden
  37.  * jarno@kcbbs.gen.nz
  38.  *
  39.  * - Callback functions take stdargs
  40.  * - Changes quantizer to output handler
  41.  * - Added handlerwindow flag
  42.  * - Added mywindow flag
  43.  *
  44.  */
  45.  
  46.  
  47. #include <exec/types.h>
  48.  
  49. #include "gl/glut.h"
  50. #include "gl/mesadriver.h"
  51.  
  52.  
  53. #define WIN_WIDTH(win)        ((win)->Width - (win)->BorderLeft - (win)->BorderRight)
  54. #define WIN_HEIGHT(win)        ((win)->Height - (win)->BorderTop - (win)->BorderBottom)
  55.  
  56.  
  57. struct GlutMenuEntry
  58. {
  59.     struct GlutMenuEntry *next, *prev;
  60.  
  61.     char *name;
  62.     int value;
  63.     BOOL issubmenu;
  64.  
  65.     struct GlutMenu *menu;
  66. };
  67.  
  68.  
  69. struct GlutMenu
  70. {
  71.     int menuid;
  72.     struct GlutMenu *next, *prev;
  73.  
  74.     __stdargs void (*menufunc)(int value);
  75.  
  76.     struct GlutMenuEntry *entries;
  77.     int numentries;
  78.  
  79.     BOOL needupdate;
  80. };
  81.  
  82.  
  83. struct GlutWindow
  84. {
  85.     struct Window *window;
  86.     int winid;
  87.     BOOL mywindow;                /* Did I open the window? */
  88.     struct GlutWindow *next, *prev;
  89.  
  90.     AmigaMesaRTLContext context;
  91.  
  92.     APTR vi;
  93.  
  94.     struct Menu *menu;
  95.     struct GlutMenu *leftmenu, *middlemenu, *rightmenu;
  96.  
  97.     UWORD qualifiers;
  98.     int mousex, mousey;
  99.  
  100.     int winx, winy;                /* Shape that we want */
  101.     int winwidth, winheight;
  102.     int wincurx, wincury;        /* Shape that we believe it to currently be */
  103.     int wincurwidth, wincurheight;
  104.  
  105.     __stdargs void (*displayfunc)(void);
  106.     __stdargs void (*keyboardfunc)(unsigned char key,int x, int y);
  107.     __stdargs void (*reshapefunc)(int width, int height);
  108.     __stdargs void (*visibilityfunc)(int state);
  109.     __stdargs void (*specialfunc)(int key, int x, int y);
  110.     __stdargs void (*mousefunc)(int button, int state, int x, int y);
  111.     __stdargs void (*motionfunc)(int x, int y);
  112.     __stdargs void (*passivemotionfunc)(int x, int y);
  113.  
  114.     BOOL needredisplay;
  115.     BOOL needreshape, needreshapegui;
  116.     BOOL needposition, needpositiongui;
  117.     BOOL needvisibility, visible;
  118.     BOOL needleftmenu, needmiddlemenu, needrightmenu;
  119. };
  120.  
  121.  
  122. struct GlutStuff
  123. {
  124.     struct MsgPort *msgport;
  125.     struct GlutWindow *curwin;
  126.     struct GlutWindow *wins;
  127.     int nextwinid;
  128.  
  129.     struct GlutMenu *curmenu;
  130.     struct GlutMenu *menus;
  131.     int nextmenuid;
  132.  
  133.     int initposx, initposy;
  134.     int initwidth, initheight;
  135.  
  136.     int numcolours;
  137.     int colourbase;
  138.     char *pubscreenname;
  139.     char *oh;
  140.     ULONG ohversion;
  141.  
  142.     BOOL handlerwindow;
  143.  
  144.     GLboolean rgba;
  145.     GLboolean alpha;
  146.     GLboolean db;
  147.     GLboolean accum;
  148.     GLboolean depth;
  149.     GLboolean stencil;
  150.     GLboolean multisample;
  151.     GLboolean stereo;
  152.     GLboolean luminance;
  153.  
  154.     __stdargs void (*idlefunc)(void);
  155.     __stdargs void (*menustatusfunc)(int status, int x, int y);
  156.  
  157.     ULONG basetime_secs, basetime_micros;
  158.     BOOL havebasetime;
  159. };
  160.  
  161.  
  162. extern struct GlutStuff glutstuff;
  163.  
  164.  
  165. int stuffGetNewWinID(void);
  166. struct GlutWindow *stuffGetWin(int winid);
  167. void stuffLinkInWin(struct GlutWindow *gw);
  168. void stuffLinkOutWin(struct GlutWindow *gw);
  169. void stuffMakeCurrent(struct GlutWindow *gw);
  170.  
  171. int stuffGetNewMenuID(void);
  172. struct GlutMenu *stuffGetMenu(int menuid);
  173. void stuffLinkInMenu(struct GlutMenu *gm);
  174. void stuffLinkOutMenu(struct GlutMenu *gm);
  175. void stuffMakeCurrentMenu(struct GlutMenu *gm);
  176.  
  177. struct GlutMenuEntry *stuffGetMenuEntry(int entry,struct GlutMenu *gm);
  178. void stuffLinkInMenuEntry(struct GlutMenuEntry *gme,struct GlutMenu *gm);
  179. void stuffLinkOutMenuEntry(struct GlutMenuEntry *gme,struct GlutMenu *gm);
  180.